<!DOCTYPE html>
<html>

<head>
    <meta name="layout" content="main" />
    <g:set var="entityName" value="${message(code: 'community.label', default: 'Community')}" />
    <title>小区</title>
</head>

<body class="fixed-navbar fixed-sidebar">
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>贷款管理系统</li>
                    <li class="active">
                        <span>小区</span>
                    </li>
                </ol>
            </div>
            <h2 class="font-light m-b-xs">
                小区
            </h2>
        </div>
    </div>
</div>
<div class="content animate-panel">
    <div class="row">
        <g:form method="POST" action="searchCommunity">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    <div class="panel-tools">
                        <button class="btn btn-primary btn-xs" type="submit"><i class="fa fa-search"></i>查询</button>
                        <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn"><i class="fa fa-times"></i>重置</button>
                    </div>
                    查询
                </div>
                <div class="panel-body">
                    <div class="col-sm-4">
                        <input type="text" class="form-control" placeholder="小区名称" name="name" id="name" value="${params?.name}">
                    </div>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" placeholder="所属区域" name="district" id="district" value="${params?.district}">
                    </div>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" placeholder="所属城市" name="city" id="city" value="${params?.city}">
                    </div>
                </div>
            </div>
        </g:form>
        <g:if test="${flash.message}">
            <div class="row">
                <div class="hpanel">
                    <div class="panel-body">
                        <div class="alert alert-info" role="alert">${flash.message}</div>
                    </div>
                </div>
            </div>
        </g:if>
    </div>
    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                所有小区
            </div>
            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover">
                        <thead>
                        <tr>
                            <g:sortableColumn property="name" title="${message(code: 'community.name.label', default: '小区')}" />
                            <g:sortableColumn property="district" title="${message(code: 'community.district.name.label', default: '所属区域')}" />
                            <g:sortableColumn property="city" title="${message(code: 'community.district.city.name.label', default: '所属城市')}" />
                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${communityList}">
                            <tr>
                                <td>
                                    <g:link action="show" id="${it.id}" class="firstTd">${it.name}</g:link>
                                </td>
                                <td>${it.district?.name}</td>
                                <td>${it.district?.city?.name}</td>
                            </tr>
                        </g:each>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="panel-footer">
                <div class="pagination">
                    <g:paginate total="${communityCount ?: 0}" params="${params}" />
                </div>
            </div>
        </div>
    </div>
</div>
<g:javascript>
    $(function(){
        $("#resetBtn").click(function () {
            $("#name").val("");
            $("#city").val("");
            $("#community").val("");
        })
    });

</g:javascript>
</body>
</html>
